package com.yupi.yuaiagent.App;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

@Component
@Slf4j
public class PomeApp {
    private final ChatClient chatClient;

    public PomeApp (ChatClient.Builder chatClientBuilder) {
        this.chatClient =
                chatClientBuilder.build();
    }
    @GetMapping("/ai")
    String doChat(String userInput){
        return this.chatClient.prompt()
                .user(userInput)
                .call()
                .content();
    }


}

